Skip to content

fix(id): repair 5 failing lib tests blocking the NixOS system build - #3211

Merged
dezren39 merged 3 commits into
mainfrom
fix/id-five-failing-tests
Oct 31, 2026
Merged

dezren39 merged 3 commits into
mainfrom
fix/id-five-failing-tests

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #3160

What

Five pkgs/id lib tests failing on main, which also fail the id package's nix check phase and therefore block every NixOS system build (id → unit-id-primary.service → system-units → etc → toplevel). Three unrelated drifts, three commits:

  1. No-SQLite guard vs the bridge PoC dev-dependency (store_traits.rs)
  2. roc-counter fuel re-baseline after the pf.Screen migration (sandbox.rs, commands/world.rs)
  3. world_ws tests catching up with the Screen capability model (web/world_ws.rs)

Diagnosis and rationale

1. The guard read the raw lockfile; the lock is not the shipped graph

The store is redb. The 2026-10-12 guard asserted the raw Cargo.lock names no SQLite-family crate, keeping SQLite out of the shipped build while p2panda-sync is vendored with p2panda-store's sqlx/SQLite backend disabled (vendor/README.md). #2276 then added rusqlite (bundled) as a dev-dependency for the bridge PoC's DO-shaped hosted store. Dev-only — it never ships — but the lock resolves dev-dependencies too, so the text scan false-fires.

The test now parses the lock into the resolved package graph (name/version/dependency edges, exactly as cargo records them) and asserts what the guard always meant:

  • this package's manifest declares SQLite-family names only under dev-dependencies (if it stopped declaring them at all, the guard would lose track of the family's dependents and fail loudly instead);
  • every lock dependent of a SQLite-family package is either SQLite-family itself (rusqlite → libsqlite3-sys) or this package — so rusqlite may exist in the lock only as this package's dev edge, and any shipped dependency pulling SQLite in fails the test;
  • the original teeth are kept: p2panda-sync must be wired in the lock, and the vendored p2panda-store must keep default-features = false.

The PoC and its dev-dependency are untouched, and the shipped graph still contains no SQLite: the only family members in the lock are rusqlite 0.32.1 and libsqlite3-sys 0.30.1, reachable solely from the root package's dev edge.

2. roc-counter outgrew its fuel budgets when it learned to render a screen

#565 migrated roc-counter from a bare text view to rendering through pf.Screen (a boxed 20×3 structured screen). Fuel is wasmtime's per-call execution budget, and the FUEL_BUDGETS table is the regression guardrail for it (baseline +25%, rounded up to the next 100,000). Rendering the screen genuinely costs more: View measures 260,269 and Layout 323,425 against the stale 100,000 budgets (pre-migration baselines were 1,327 / 1,337). The new numbers are the same order as roc-screen's honest baselines for the same Screen rendering (123,675 / 378,384), and they reproduce exactly in the failing nix build log and locally. Regenerated with the shipped print_fuel_baseline generator: View 400,000, Layout 500,000; no other row's budget changes.

The id world measure test does not read FUEL_BUDGETS — it carries its own bound: the module's worst call must stay under 1% of the 10,000,000 default fuel limit. That 1% was the same stale pre-Screen assumption (the worst call is Layout at 3.23% now). The bound is updated consistently with the re-baselined envelope — largest per-call budget the table allows this module is 500,000 = 5% of the limit — with the tie to FUEL_BUDGETS spelled out in a comment so the two move together next time.

3. The world_ws tests predated the capability grant model and the screen frame

  • Compile test: roc-counter's main.roc imports pf.Screen and pf.RocText. The compile gate admits only capabilities the world has granted (the server ceiling in WorldLimits::default() already covers the full catalog), and the test world had granted nothing — so the gate correctly refused. The test now grants both via world.update_caps, the same admin path as id world caps --grant. The ceiling/grant check itself is not weakened.
  • Upload test: the module's view now returns a pf.Screen frame instead of bare text, so the snapshot/event payload is the screen JSON. The expectations now parse that JSON, assert kind == "screen", and assert a row shows count=0 / count=1 (the row text itself is exactly what the screen renders, padding included), via a small shared helper used at all four assertion sites.

Verification

  • The five named tests pass: the guard, the measure test, and both world_ws tests were run individually against a local --release --lib --features web build; the fuel-budget test passes with the re-baselined table.
  • Local full lib suite: 1974 passed, 2 failed, 6 ignored — neither failure is one of the five or caused by this diff (see the note below).
  • nix build .#id-web from the repo root (the package the NixOS id-mail module consumes) — check phase green: lib suite 1976 passed, 0 failed, 6 ignored, all five fixed tests ok, output at /nix/store/h5jp2vrmfz9hl38jzlhqxw6ljjaq7am4-id-0.1.0. A first attempt's check phase failed only on the two log_sync tests in the note below; the retry passed everything.
  • rustfmt --check clean on all four touched files. No tests deleted, excluded, or ignored; no production behaviour changes.

Note: pre-existing log_sync timing flake (not this change)

log_sync::tests::test_batch_collection_coalesces_paced_arrivals and test_batch_collection_refused_stream_ends_at_the_total_cap race a 2 ms test pacing thread against the production 5 ms BATCH_GRACE wall-clock idle window; under heavy machine load (parallel builds running) they intermittently split or end the batch early (observed: batch lengths 2-of-3 and 1-of-256). They are untouched by this diff, passed in the original failing system build, and pass when the machine is not saturated — 26/26 solo re-runs at moderate load, and both green in the successful nix run above. Filed separately as #3199 with the full evidence and a suggested seam. Separately, one local-only failure (web::tests::test_load_asset_urls_from_manifest) was an artifact of the placeholder web/dist in the local worktree; it passes in the nix build, which compiles the real hashed assets.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…w lock

The guard asserted the raw Cargo.lock names no SQLite-family crate.
#2276 dev-depends on rusqlite (bundled) for the bridge PoC's hosted
store, and the lock resolves dev-dependencies too, so the text scan
false-fires even though the shipped store is still redb and nothing
that ships links SQLite.

The test now parses the lock into the resolved package graph: a
SQLite-family package may appear only when every package depending on
it is SQLite-family itself or this package, and this package's
manifest is checked section by section so SQLite names may be declared
only under dev-dependencies. A shipped dependency pulling SQLite in,
or the manifest moving rusqlite out of dev-dependencies, still fails
the guard, as do a missing p2panda-sync or the vendored p2panda-store
line losing default-features = false.

Refs #3160
…ration

#565 migrated roc-counter from a bare text view to rendering through
pf.Screen, a boxed 20x3 structured screen. Rendering the screen costs
more wasmtime fuel than returning a string: View now measures 260,269
and Layout 323,425 against the stale 100,000 budgets (pre-migration
baselines were 1,327 and 1,337). Regenerated with the shipped
print_fuel_baseline generator under the table's own rule (baseline
+25%, rounded up to the next 100,000): View 400,000, Layout 500,000.
Both measurements match the failing nix build log exactly; no other
row's budget changes.

The `id world measure` test carries its own bound (worst call < 1% of
the 10,000,000 fuel limit) — the same pre-Screen assumption. Update it
consistently with the re-baselined envelope: the worst call is Layout
at 3.23%, and the largest per-call budget the table allows this module
is 500,000 = 5% of the limit, so the bound is now < 5 percent with
the tie to FUEL_BUDGETS spelled out in a comment.

Refs #3160
Compile test: roc-counter's main.roc imports pf.Screen and pf.RocText,
and the compile gate admits only capabilities the world has granted.
The test world granted nothing, so the gate correctly refused the
compile. Grant both through world.update_caps, the same admin path as
`id world caps --grant`; the ceiling check itself is untouched.

Upload test: the module's view now returns a pf.Screen frame, so the
snapshot/event data assertions expecting bare "count=0"/"count=1"
text now parse the screen JSON, assert kind == "screen", and assert
a row shows the expected count. Both tests share a small
assert_screen_data helper.

Refs #3160
@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 20:34
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T20:34:53.652139Z
We couldn’t complete this review. Comment @codex review to try again.
e3061ec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d9c3b21-f5f3-4ca9-8f81-be8b7f0f46ad
Commits

Reviewing files that changed from the base of the PR and between 36a3347 and e3061ec.

Files selected for processing: 4
  • pkgs/id/src/commands/world.rs
  • pkgs/id/src/sandbox.rs
  • pkgs/id/src/store_traits.rs
  • pkgs/id/src/web/world_ws.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39
dezren39 merged commit bdfde61 into main Oct 31, 2026
1 check passed
@dezren39
dezren39 deleted the fix/id-five-failing-tests branch October 31, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkgs/id: 5 lib tests failing on main block the NixOS system build (rusqlite guard, fuel budgets, world_ws Screen drift)

1 participant